/**
**************************************************************************************
*Founder Effect                                                                      *
*Copyright (C) 2006-2007, 5d Studios (www.5d-Studios.com)                            *
*                                                                                    *
*This library is free software; you can redistribute it and/or                       *
*modify it under the terms of the GNU Lesser General Public                          *
*License as published by the Free Software Foundation; either                        *
*version 2.1 of the License, or (at your option) any later version.                  *
*                                                                                    *
*This library is distributed in the hope that it will be useful,                     *
*but WITHOUT ANY WARRANTY; without even the implied warranty of                      *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                   *
*Lesser General Public License for more details.                                     *
*                                                                                    *
*You should have received a copy of the GNU Lesser General Public                    *
*License along with this library; if not, write to the Free Software                 *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA      *
**************************************************************************************
*/
#pragma once
#include <string>

#define BUFFER_SIZE 1024

/**
=============================
A buffer is a text area that excepts input from
the IInput subsystem
=============================
*/
class InputBuffer
{
public:
	InputBuffer();
	virtual ~InputBuffer();

    /** Get the string buffer */
	std::string GetBuffer();
    /** Set a new buffer */
	void  SetBuffer(const std::string &s);
    /** Get the carrot position in the buffer */
    int   GetCarrotPos();
    /** Get the used length */
    size_t   Length() { return m_sBuffer.length(); };
    
    /** Clear the buffer */
    void  Clear();
    /** process a key event */
    void  ProcessKey(bool down, int key);

    /** Test to see if this buffer is active */
    bool  IsActive();
    /** Activate this buffer */
    void  SetActive(bool);

private:
    /** Append a char to the buffer */
    void  Append(char);

    // actual buffer
	std::string m_sBuffer;
    // location in the used buffer
    int   m_carrot;
    // top of the used buffer
    int   m_top;
    // status
    bool  m_active;
    // case
    bool  m_upperCase;
    // CAPITOL LOCKS   
    bool    m_CapitolLocks;

};

